package com.xjscrm.console.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xjscrm.console.entity.ChatTalkSessionStaffRel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author mingyang.chen create in 2024/4/1 17:40
 */
@Mapper
public interface ChatTalkSessionStaffRelMapper extends CommonMapper<ChatTalkSessionStaffRel> {
    int deleteByPrimaryKey(Long id);

    int insertSelective(ChatTalkSessionStaffRel record);

    ChatTalkSessionStaffRel selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ChatTalkSessionStaffRel record);

    List<ChatTalkSessionStaffRel> selectListByStaffId(@Param("merId") Long merId, @Param("staffId") Long staffId);

    List<ChatTalkSessionStaffRel> selectPageByStaffId(Page<ChatTalkSessionStaffRel> page, @Param("merId") Long merId, @Param("staffId") Long staffId);

    List<ChatTalkSessionStaffRel> selectListByStaffIdAndDeviceUniqueId(@Param("merId") Long merId, @Param("deviceUniqueId") Long deviceUniqueId, @Param("staffId") Long staffId);

    List<ChatTalkSessionStaffRel> selectPageByStaffIdAndDeviceUniqueId(Page<ChatTalkSessionStaffRel> page, @Param("merId") Long merId, @Param("deviceUniqueId") Long deviceUniqueId, @Param("staffId") Long staffId);

    List<ChatTalkSessionStaffRel> selectListBySessionIds(@Param("merId") Long merId, @Param("staffId") Long staffId,
                                                         @Param("sessionIds") List<Long> sessionIds);

    int deleteByStaffIdWithEnd(@Param("merId") Long merId, @Param("staffId") Long staffId);

    void updateWithReply(@Param("id") Long id, @Param("merId") Long merId);

    int countByStaffId(@Param("merId") Long merId, @Param("staffId") Long staffId);

    ChatTalkSessionStaffRel selectOneByConvIdAndSessionId(@Param("merId") Long merId, @Param("convId") String wxId, @Param("sessionId") Long sessionId);

    ChatTalkSessionStaffRel selectOne(@Param("param") ChatTalkSessionStaffRel sessionStaffRel);

    List<ChatTalkSessionStaffRel> selectListByStaffIdWithEnd(@Param("merId") Long merId, @Param("staffId") Long staffId);

    int updateWithCleanEndAndExpire(@Param("merId") Long merId, @Param("id") Long id);

    ChatTalkSessionStaffRel selectOneBySessionId(@Param("merId") Long merId, @Param("deviceUniqueId") Long deviceUniqueId, @Param("talkSessionId") Long talkSessionId);

    Integer countHangByStaffId(@Param("merId") Long merId, @Param("staffId") Long staffId);

    List<ChatTalkSessionStaffRel> selectPageByCondition(Page<ChatTalkSessionStaffRel> page, @Param("query") ChatTalkSessionStaffRel query);
}